package com.zygh.lz.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zygh.lz.entity.XareaRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface XareaRecordMapper extends BaseMapper<XareaRecord> {

    @Select("SELECT id,record_type as recordType,update_by as updateBy,s.staff_name as staffName," +
            "DATE_FORMAT(x.update_time,'%Y-%m-%d %H:%i:%s')  as updateTime,xarea_id as xareaId FROM xarea_record x " +
            "LEFT JOIN staff s ON x.update_by = s.staff_num ")
    List<Map<String, Object>> findXareaRecorByUp();


    //修改记录表里修改后数据
    @Select("SELECT * FROM xarea_record WHERE xarea_id = #{xareaId} AND id > #{id} LIMIT 1")
    XareaRecord findUpdate(@Param("xareaId") Integer xareaId,
                           @Param("id") Integer id);

}
